<?php
namespace common\modules\content\models\query;

use common\modules\content\models\ArticleCategory;
use yii\db\ActiveQuery;

/**
 * This is the ActiveQuery class for [[\common\modules\content\models\ArticleCategory]].
 *
 * @see \common\modules\content\models\ArticleCategory
 */
class ArticleCategoryQuery extends ActiveQuery
{

    /**
     *
     * @return $this
     */
    public function active()
    {
        $this->andWhere([
            'status' => ArticleCategory::STATUS_ACTIVE
        ]);
        
        return $this;
    }

    /**
     *
     * @return $this
     */
    public function noParents()
    {
        $this->andWhere('{{%article_category}}.parent_id IS NULL');
        
        return $this;
    }
}
